#include "order.h"
#include <QTextStream>

Order::Order(int order_id,
             QString flight_id,
             QString seat_type,
             double price,
             QString order_status,
             QDateTime payment_time,
             QDateTime refund_time,
             QDateTime created_at,
             FlightInfo flight_info)
    : order_id(order_id)
    , flight_id(flight_id)
    , seat_type(seat_type)
    , price(price)
    , order_status(order_status)
    , payment_time(payment_time)
    , refund_time(refund_time)
    , created_at(created_at)
    , flight_info(flight_info)
{}

void Order::printOrder() const
{
    qDebug() << "Order ID:" << order_id << "Flight ID:" << flight_id << "Seat Type:" << seat_type
             << "Price:" << price << "Order Status:" << order_status
             << "Payment Time:" << payment_time.toString("yyyy-MM-dd HH:mm:ss")
             << "Refund Time:" << refund_time.toString("yyyy-MM-dd HH:mm:ss")
             << "Created At:" << created_at.toString("yyyy-MM-dd HH:mm:ss");
    //flightInfo.printFlightInfo();  // 打印与订单相关的航班信息
}

QString Order::formatTime(const QDateTime &time) const
{
    return time.toString("yyyy-MM-dd HH:mm:ss");
}
